/*******************************************************************************
* Copyright (C) 2013 Spansion LLC. All Rights Reserved. 
*
* This software is owned and published by: 
* Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA  94088-3453 ("Spansion").
*
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND 
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
*
* This software contains source code for use with Spansion 
* components. This software is licensed by Spansion to be adapted only 
* for use in systems utilizing Spansion components. Spansion shall not be 
* responsible for misuse or illegal use of this software for devices not 
* supported herein.  Spansion is providing this software "AS IS" and will 
* not be responsible for issues arising from incorrect user implementation 
* of the software.  
*
* SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS), 
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING, 
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED 
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED 
* WARRANTY OF NONINFRINGEMENT.  
* SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT, 
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT 
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, 
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR 
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT, 
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA, 
* SAVINGS OR PROFITS, 
* EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED 
* FROM, THE SOFTWARE.  
*
* This software may be replicated in part or whole for the licensed use, 
* with the restriction that this Disclaimer and Copyright notice must be 
* included with each copy of this software, whether used in part or whole, 
* at all times.  
*******************************************************************************/
/******************************************************************************
	GDC Access Library V04
	GDC_AL_V04L01
*******************************************************************************/

#ifndef _FCI_H_
#define _FCI_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef signed char  FCI_INT8S;
typedef signed short FCI_INT16S;
typedef signed long  FCI_INT32S;

typedef unsigned char  FCI_INT8U;
typedef unsigned short FCI_INT16U;
typedef unsigned long  FCI_INT32U;

#define FCI_NG            (0U)
#define FCI_OK            (1U)

#define FCI_FALSE         (0U)
#define FCI_TRUE          (1U)

/* color bpp */
#define FCI_8BPP          (0x00U)
#define FCI_16BPP         (0x01U)
#define FCI_32BPP         (0x02U)

#define FCI_BPP_01        (0x10U)
#define FCI_BPP_02        (0x11U)
#define FCI_BPP_04        (0x12U)
#define FCI_BPP_08        (0x13U)
#define FCI_BPP_16        (0x14U)
#define FCI_BPP_24        (0x15U)
#define FCI_BPP_32        (0x16U)

#define FCI_BPP_FF        (0xFFU)

/* color order type */
#define FCI_RGBA          (0x00U)    /* RGBA8888(32BPP) RGBA5551(16BPP) */
#define FCI_ARGB          (0x01U)    /* ARGB8888(32BPP) ARGB1555(16BPP) */

#define FCI_ARGB_8888     (0x20U)    /* ARGB8888(32BPP) */
#define FCI_ARGB_6666     (0x21U)    /* ARGB6666(24BPP) */
#define FCI_ARGB_4444     (0x22U)    /* ARGB4444(16BPP) */
#define FCI_ARGB_1555     (0x23U)    /* ARGB1555(16BPP) */

#define FCI_RGBA_8888     (0x30U)    /* RGBA8888(32BPP) */
#define FCI_RGBA_6666     (0x31U)    /* RGBA6666(24BPP) */
#define FCI_RGBA_4444     (0x32U)    /* RGBA4444(16BPP) */
#define FCI_RGBA_5551     (0x33U)    /* RGBA5551(16BPP) */

#define FCI_RGB_888       (0x40U)    /* RGB888(24BPP) */
#define FCI_RGB_565       (0x41U)    /* RGB565(16BPP) */

#define FCI_A_8           (0x60U)    /* A8(8BPP) */
#define FCI_R_8           (0x61U)    /* R8(8BPP) */
#define FCI_G_8           (0x62U)    /* G8(8BPP) */
#define FCI_B_8           (0x63U)    /* B8(8BPP) */

#define FCI_INDEX_COLOR   (0x80U)    /* Index Mode */

#define FCI_UNKNOWN       (0xFFU)

/* endian type */
#define FCI_LITTLE        (0x00U)
#define FCI_BIG           (0x80U)

/* data type */
#define FCI_BYTE_DATA    (0x01U)
#define FCI_HALF_DATA    (0x02U)
#define FCI_WORD_DATA    (0x04U)

/* extention mode */
#define FCI_NORMAL_MODE    (0x00U)

#define FCI_CT_MODE        FCI_NORMAL_MODE
#define FCI_RL_MODE        (0x01U)
#define FCI_SPRITE_MODE    (0x20U)
#define FCI_SOFT_MODE      (0x40U)
#define FCI_NC_MODE        (0x80U)

/* error code */
#define FCI_SUCCESS       (0x00000001L)
#define FCI_ERROR         (0x80000000L)
#define FCI_ERROR_PARAM   (0x80000001L)
#define FCI_ERROR_BUFFER  (0x80000002L)
#define FCI_ERROR_DATA    (0x80000003L)
#define FCI_ERROR_IMAGE   (0x80000004L)
#define FCI_ERROR_SUPPORT (0x80000005L)

#define FCI_WARNING       (0x81000000L)
#define FCI_WARNING_SIZE  (0x81000001L)

#define FCI_NULL            ((void *)0)
#define FCI_INVALID_OFFSET  (0xFFFFFFFFUL)

typedef struct {
    FCI_INT32U size;      /* data size */
    FCI_INT16U width;     /* image width */
    FCI_INT16U height;    /* image height */
    FCI_INT8U  level;     /* mipmap max level */
    FCI_INT8U  extention; /* extention mode 0:normal 1: */
    FCI_INT8U  bpp;       /* color bpp */
    FCI_INT8U  order;     /* color order type */
    FCI_INT16U paletteCount; /* palette color */
    FCI_INT8U  paletteOrder; /* palette color order type */
    FCI_INT8U  type;         /* endian & data type */
} FCI_HEADER;

typedef struct {
    FCI_HEADER header;
    FCI_INT8U *palette;
    FCI_INT8U *data;
#ifdef ALPHA_MODE
    FCI_INT8U *alpha;
#endif
} FCI_DATA;

#ifdef __cplusplus
}
#endif

#endif
